<?php
	function completion($msg,$num){//补0
		$n=pow(10,$num);
		$n=$n+$msg;
		$n=substr($n,1,$num);
		return $n;
	}
	function upimages($name,$address,$image){//上传图片
		header("content-type:text/html;charset=utf-8");//上传图片并改变大小
        date_default_timezone_set("PRC");
        $pImg=$_FILES["$image"];
        if(isset($pImg)){
            if($pImg['error']==UPLOAD_ERR_OK){
            //取得扩展名
            $extName=strtolower(end(explode('.',$pImg['name'])));
            //echo $extName;
            $filename_picture=$name.".".$extName;
            //echo $filename;
            $dest_picture="Public/".$address."/".$filename_picture;//
            move_uploaded_file($pImg['tmp_name'],$dest_picture);
		    return $dest_picture;//地址
	        }
	    }
	}
	function int_number($msg){//多0.2取整
		$n=$msg%100;
		$m=floor($msg/100);
		if($n>20){
			$m=$m+1;
		}
		return $m;
	}
	function snocompletion($sno){
		if(strlen($sno)<12){
		    $sno=100000000000+$sno;
		}
		return $sno;
	}
	function ant($ant){
		$ant=preg_replace('#,{2,}#',',',$ant);
		$ant=ltrim($ant,',');
		$ant=rtrim($ant,',');
		return $ant;
	}
	function i_array_column($input, $columnKey, $indexKey=null){//array_column二维转一维
		if(!function_exists('array_column')){ 
			$columnKeyIsNumber  = (is_numeric($columnKey))?true:false; 
			$indexKeyIsNull            = (is_null($indexKey))?true :false; 
			$indexKeyIsNumber     = (is_numeric($indexKey))?true:false; 
			$result                         = array(); 
			foreach((array)$input as $key=>$row){ 
				if($columnKeyIsNumber){ 
					$tmp= array_slice($row, $columnKey, 1); 
					$tmp= (is_array($tmp) && !empty($tmp))?current($tmp):null; 
				}else{ 
					$tmp= isset($row[$columnKey])?$row[$columnKey]:null; 
				} 
				if(!$indexKeyIsNull){ 
					if($indexKeyIsNumber){ 
					  $key = array_slice($row, $indexKey, 1); 
					  $key = (is_array($key) && !empty($key))?current($key):null; 
					  $key = is_null($key)?0:$key; 
					}else{ 
					  $key = isset($row[$indexKey])?$row[$indexKey]:0; 
					} 
				} 
				$result[$key] = $tmp; 
			} 
			return $result; 
		}else{
			return array_column($input, $columnKey, $indexKey);
		}
    }
?>